<?php
class User_Model_ShippingDetail extends Zend_Db_Table{
	protected $_name = 'shipping_detail';
	protected $_primary = 'shipping_detail_id';
	/* Link tham khao : http://framework.zend.com/manual/en/zend.db.table.html */
	/* select demo */
	
	public function insertShipping($data)
	{// co dung
		  
		$data['route'] = "insertShipping";
		$client = new Zend_Rest_Client(HTTP_SERVICE);
		$return = $client->restPost("/shippingdetail", $data);

		return $return->getBody();
	}
	
	//lay thong tin shipping detail theo id
	public function getShippingDetailById($id)
	{// co dung
		$client = new Zend_Rest_Client(HTTP_SERVICE);
		$return = $client->restGet("/shippingdetail/route/getShippingDetailById/id/".$id);
	
		$return = json_decode(json_encode((array) simplexml_load_string($return->getBody())),1);

		for ($i=0;$i <count($return);$i++)
		{
			$data[$i] = $return['row_'.$i];
		}	
		return $data;
	}
}